﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;

namespace QLCHHoaLan
{
    public partial class FrmTimKiemNhaCungCap : Form
    {
        public FrmTimKiemNhaCungCap()
        {
            InitializeComponent();
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            Menu main = new Menu();
            main.kq = 1;
            main.Show();
            this.Hide();
        }

        private void btnTim_Click(object sender, EventArgs e)
        {
            if (txtTen.Text == "" && txtSoDienThoai.Text == "" && txtEmail.Text == "")
            {
                MessageBox.Show("Hãy nhập thông tin tìm kiếm");
            }
            else
            {
                NhaCungCapDTO nccdto = new NhaCungCapDTO();
                nccdto.TenNCC = txtTen.Text;
                nccdto.SDT = txtSoDienThoai.Text;
                nccdto.Email = txtEmail.Text;

                NhaCungCapBUS nccbus = new NhaCungCapBUS();
                DataTable dt = new DataTable();
                dt = nccbus.TimKiemNCC(nccdto.TenNCC, nccdto.SDT, nccdto.Email);
                dgvTimKiemNhaCungCap.DataSource = dt;
            }

        }

        private void dgvTimKiemNhaCungCap_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            txtEmail.Text = "";
            txtSoDienThoai.Text = "";
            txtSoDienThoai.Text = "";
        }

       

    }
}
